gusucode.com > 支持向量机工具箱 - LIBSVM OSU_SVM LS_SVM源码程序 > 支持向量机工具箱 - LIBSVM OSU_SVM LS_SVM\stprtool\setpath.m
function []=setpath(toolboxroot) % []=setpath(toolboxroot) % % SETPATH adds path of the Statistical Pattern Recognition Toolbox. % The function argument determines where the root directory % of the toolbox is located. If no argument is given then a current % directory is taken as the root directory. % % Statistical Pattern Recognition Toolbox, Vojtech Franc, Vaclav Hlavac % (c) Czech Technical University Prague, http://cmp.felk.cvut.cz % Written Vojtech Franc (diploma thesis) 02.01.2000 % Modifications % 23-mar-2001, V.Franc, added new directories if nargin < 1 toolboxroot=pwd; % get current directory end disp('Adding path for the Statistical Pattern Recognition Toolbox...'); % path definition for UNIX p = ['$:',... '$svm:',... '$pca:',... '$linear:',... '$linear/anderson:',... '$linear/finite:',... '$linear/fisher:',... '$learning:',... '$learning/minimax:',... '$learning/unsuper:',... '$quadrat:',... '$generalp:',... '$datasets:',... '$bayes']; p=translate(p,toolboxroot); % adds path at the start path(p,path); %--translate --------------------------------------------------------- function p = translate(p,toolboxroot); %TRANSLATE Translate unix path to platform specific path % TRANSLATE fixes up the path so that it's valid on non-UNIX platforms % % This function was derived from MathWork M-file "pathdef.m" cname = computer; % Look for VMS, this covers VAX_VMSxx as well as AXP_VMSxx. %if (length (cname) >= 7) & strcmp(cname(4:7),'_VMS') % p = strrep(p,'/','.'); % p = strrep(p,':','],'); % p = strrep(p,'$toolbox.','toolbox:['); % p = strrep(p,'$','matlab:['); % p = [p ']']; % Append a final ']' % Look for PC if strncmp(cname,'PC',2) p = strrep(p,'/','\'); p = strrep(p,':',';'); p = strrep(p,'$',[toolboxroot '\']); % Look for MAC elseif strncmp(cname,'MAC',3) p = strrep(p,':',':;'); p = strrep(p,'/',':'); m = toolboxroot; if m(end) ~= ':' p = strrep(p,'$',[toolboxroot ':']); else p = strrep(p,'$',toolboxroot); end else p = strrep(p,'$',[toolboxroot '/']); end